﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CsvHelper;
using EasySolutionForAll.Models.Quiz;

namespace EasySolutionForAll.Controllers
{
    public class QuestionSetController : Controller
    {
        // GET: QuestionSet
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult UploadFile(HttpPostedFileBase questionSet)
        {
            ICsvParser csvParser = new CsvParser(new StreamReader(questionSet.InputStream));
            CsvReader csvReader = new CsvReader(csvParser);
            var models = csvReader.GetRecords<CsvMapModel>();
            CsvMapModel.Submit(models.ToList());
            return new EmptyResult();
        }

        
    }
}